#ifndef COMMON_H
#define COMMON_H

#include "script/glue/LuaGlue.h"

#ifdef DECLARE
#undef DECLARE
#endif

#ifdef END
#undef END
#endif

#define DECLARE(x) class x{public:\
		static const char className[];\
		static const luaL_reg meta[];\
		static const luaL_reg methods[];\
		static int create(lua_State *L);
#define METHOD(x) static int x(lua_State* L);
#define END };

namespace LuaGlue
{
	//{{{ Ogre
	DECLARE(Camera)
	METHOD(tostring)
	METHOD(gc)
	METHOD(getPosition)
	METHOD(setPosition)
	METHOD(getOrientation)
	METHOD(setOrientation)
	END

	DECLARE(Overlay)
	END
	
	DECLARE(ColourValue)
	METHOD(tostring)
	METHOD(get)
	METHOD(set)
	METHOD(add)
	END
	
	DECLARE(Degree)
	METHOD(tostring)
	METHOD(valueRadians)
	END

	DECLARE(Radian)
	METHOD(tostring)
	METHOD(valueDegrees)
	END
	
	DECLARE(Quaternion)
	METHOD(get)
	METHOD(set)
	METHOD(add)
	METHOD(mul)
	METHOD(tostring)
	METHOD(normalise)
	METHOD(Euler)
	METHOD(FromAngleAxis)
	METHOD(Slerp)
	METHOD(xAxis)
	METHOD(yAxis)
	METHOD(zAxis)
	END	

	DECLARE(Vector3)
	METHOD(get)
	METHOD(set)
	METHOD(tostring)
	METHOD(add)
	METHOD(sub)
	METHOD(mul)
//	METHOD(div)
	METHOD(length)
	METHOD(normalise)
	METHOD(getRotationTo)
	END
	//}}}
	
	//{{{ Bullet
	DECLARE(RigidBody)
	METHOD(tostring)
	METHOD(applyForce)
	METHOD(applyTorque)
	END
	//}}}
	
	//{{{ Game
	DECLARE(App)
	METHOD(run)
	METHOD(loadScene)
	METHOD(getCamera)
	METHOD(frameTime)
	END

	DECLARE(Object)
	METHOD(tostring)
	METHOD(get)
	METHOD(set)
	METHOD(gc)
	METHOD(getName)
	METHOD(getXmlString)
	METHOD(toTable)
	END

	DECLARE(GameObject)
	METHOD(get)
	METHOD(set)
	METHOD(getByName)
	METHOD(getObjectsTable)
	METHOD(getName)
	METHOD(toObject)
	METHOD(toString)
	METHOD(addComponent)
	END
	
	DECLARE(Timer)
	METHOD(getTime)
	METHOD(delay)
	END	
	//}}}

}

#endif
